#pragma once

class Protocol : boost::noncopyable
{
public:
	virtual ~Protocol() {};

	virtual void init(const std::string& com_device) = 0;
	virtual void update() = 0;

	struct RC_Input
	{
		float channels[8];
	};
	struct Motors
	{
		float output[8];
	};
	//in radians
	struct Attitude
	{
		float roll;
		float pitch;
		float yaw;
	};				  

	struct Status
	{
		bool home_set;
		bool is_armed;
		bool simple_mode;
		bool auto_altitude;
		bool auto_throttle;
		bool low_battery;
		bool failsafe_battery;
		bool failsafe_radio;
		bool is_logging;
	};

	enum class Control_Mode
	{
		STABILIZE = 0,
		ACROBATIC = 1,
		ALTITUDE_HOLD = 2,
		AUTO = 3,
		GUIDED = 4,
		LOITER = 5,
		RETURN_TO_LAUNCH = 6,
		CIRCLE = 7,
		POSITION = 8,
		LAND = 9,
		OPTICAL_FLOW_LOITER = 10,
	};

	struct Data
	{
		float voltage; //volts
		float current; //amperes
		float capacity; //0 - 1
		float tx_rssi; //db
		float rx_rssi; //db
		RC_Input rc_input;
		Motors motors;
		Attitude attitude;
		float altitude; //meters
		Status status;
		Control_Mode control_mode;
	};

	virtual Data get_data() const = 0;
	virtual float get_update_frequency() const = 0;

	virtual uint32_t get_packet_loss() const = 0;
};
